package com.yanqu.road.server.cmd.activity.shuihuyezicard;

import com.yanqu.road.pb.activity.ShuiHuYeZiCardProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.shuihuyezicard.ShuiHuYeZiCardModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @Description
 * @Author cwq
 * @Data 2021/12/23 17:57
 */
@Cmd(code = GameProtocol.S_SHUIHUYEZICARD_PVP_SYN_USER_DATA_FROM_CROSS, desc = "水浒叶子牌 跨服同步给区服玩家数据 跨服返回区服 协议")
public class ShuiHuYeZiCardPvpSynUserDataCmd  extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ShuiHuYeZiCardProto.ShuiHuYeZiCardPvpSynUserDataCrossToGameMsg crossMsg = ShuiHuYeZiCardProto.ShuiHuYeZiCardPvpSynUserDataCrossToGameMsg.parseFrom(packet.getBytes());
        ShuiHuYeZiCardModule shuiHuYeZiCardModule = player.getModule(ShuiHuYeZiCardModule.class);
        if(crossMsg.getRoomId() != shuiHuYeZiCardModule.getPvpRoomId()){
            shuiHuYeZiCardModule.setPvpRoomId(crossMsg.getRoomId());
            shuiHuYeZiCardModule.synUserData();
        }
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
